#include "stc15f2k60s2.h"
#include "Tim.h"
#include "Seg.h"
#include "stdio.h"
#include "Ptim.h"
unsigned long ulms;
unsigned char pucSeg_Buf[9],pucSeg_Code[8],ucSeg_Pos;
unsigned int count,uccount1;
unsigned char ucSeg_Dly;
void Seg_Proc(void); 
void main(){
	Cls_Peripheral() ;
	Timer1Init();
	Timer0Init();
	while(1){
		Seg_Proc();
}
}
void Time_1(void) interrupt 3 //定时器1中断函数
{ 
	 ulms++; 
	 if(!(ulms % 1000)) 
	 { 
		 uccount1=count;
		 count=0;
//		 uccount1=(TH0<<8)+TL0;
//		 TH0=0;
//		 TL0=0;
	} 
	 if(++ucSeg_Dly==500) ucSeg_Dly=0;
	 Seg_Disp(pucSeg_Code, ucSeg_Pos);
	if(++ucSeg_Pos==8) ucSeg_Pos=0;
}
void Time_0(void) interrupt 1{
	count++;
}
void Seg_Proc(void){
	if(ucSeg_Dly) return;
	ucSeg_Dly=1;
	sprintf(pucSeg_Buf,"F %06d",uccount1);
	Seg_Tran(pucSeg_Buf, pucSeg_Code);
}